package com.ebrothers.isns.common;

import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public final class JsonConverter {

	public static String beanToJson(Object bean) {
		JSONObject json = JSONObject.fromObject(bean);
		if (json != null) {
			return json.toString();
		}
		return null;
	}

	public static String beansToJson(List<?> beans) {
		JSONArray array = JSONArray.fromObject(beans);
		if (array != null) {
			return array.toString();
		}
		return null;
	}
}
